import {put, takeEvery} from "redux-saga/effects";
import {actions, types} from "@/common/container/pageContainer/store";
import {queryState} from "@/util/global";
import {getPageDetail} from "@/util/Api";

const effects = {
    * QueryPageDetail() {
        const id = queryState('pageDetail.id');
        const ajax = yield getPageDetail(id);
        if (ajax.success === false) {
            return;
        }
        yield put(actions.upState_pageDetail_all(ajax.data));
    }
}


export default function* PageDetail() {
    yield takeEvery(types.QUERY_PAGE_DETAIL, effects.QueryPageDetail);
}
